/*
 * @Author: your name
 * @Date: 2024-05-24 10:44:02
 * @LastEditTime: 2024-05-24 10:48:54
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \.leetcode\55.跳跃游戏.cpp
 */
/*
 * @lc app=leetcode.cn id=55 lang=cpp
 *
 * [55] 跳跃游戏
 */

// @lc code=start
class Solution {
public:
    bool canJump(vector<int>& nums) {
        int max_arrive_index = 0;
        for (int i = 0; i <= max_arrive_index; i++){
            max_arrive_index = max(max_arrive_index, i + nums[i]);
            if(max_arrive_index >= nums.size()-1){
                return true;
            }
        }
        return false;
        
    }
};
// @lc code=end

